//
//  NSObject+Ext.swift
//  yiplayer
//
//  Created by cgw on 2024/5/13.
//

import Foundation
extension NSObject{
    // MARK: - getModel
    func model(_ datas: [Any]?, _ ip: IndexPath? ) -> Any? {
        return model( datas, ip?.row)
    }
    
    func model(_ datas: [Any]?, _ row: Int? ) -> Any? {
        if row == nil {return nil}
        if row! < 0 {return nil}
        if let arr = datas {
            if let i = row {
                if arr.count > i {
                    return arr[i]
                }
            }
        }
        return nil;
    }
    
    func sectionModel(_ datas: [Any]?, _ ip: IndexPath? ) -> Any? {
        if let arr = datas {
            if let i = ip?.section {
                if arr.count > i {
                    return arr[i]
                }
            }
        }
        return nil;
    }
}
